<ui:composition xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui"  
	xmlns:f="http://java.sun.com/jsf/core"
	template="template/template.xhtml">
	<ui:define name="title">
		<h:outputText value="#{msgs.hierarchiesList}"/>
	</ui:define>
	<ui:define name="bodyInclude">
		<ui:include src="include/menu.xhtml" />
		<p:fieldset legend="#{msgs.hierarchiesList}" toggleable="true">
			<p:outputPanel layout="block" styleClass="container">
				<h:form id="hierarchiesForm">
					<p:dataTable currentPageReportTemplate="{currentPage} #{msgs.of} {totalPages}" emptyMessage="#{msgs.emptyDataTableMessage}" id="hierarchiesTable" paginator="true" paginatorAlwaysVisible="false" paginatorTemplate="{FirstPageLink} {PreviousPageLink} {CurrentPageReport}{PageLinks}{NextPageLink} {LastPageLink}" rows="10" rowsPerPageTemplate="5,10,20,50" selection="#{hierarchiesController.selectedHierarchies}" value="#{hierarchiesController.hierarchies}" var="hierarchy">
						<p:column rendered="#{sessionController.sessionUser.administrator}" selectionMode="multiple"/>
						<p:column headerText="#{msgs.id}" sortBy="#{hierarchy.hierarchyId}" styleClass="center">
							<h:outputText value="#{hierarchy.hierarchyId}"/>
						</p:column>
						<p:column headerText="#{msgs.project}" sortBy="#{hierarchy.project.name}" styleClass="center">
							<h:outputText value="#{hierarchy.project.name}"/>
						</p:column>
						<p:column headerText="#{msgs.version}" sortBy="#{hierarchy.version.name}" styleClass="center">
							<h:outputText value="#{hierarchy.version.name}"/>
						</p:column>
						<p:column headerText="#{msgs.creationDate}" sortBy="#{hierarchy.creationDate}" styleClass="center">
							<h:outputText value="#{hierarchy.creationDate}">
								<f:convertDateTime dateStyle="medium" locale="#{localeController.locale}"/>
							</h:outputText>
						</p:column>
						<p:column headerText="#{msgs.lastModificationDate}" sortBy="#{hierarchy.lastUpdateDate}" styleClass="center">
							<h:outputText value="#{hierarchy.lastUpdateDate}">
								<f:convertDateTime dateStyle="medium" locale="#{localeController.locale}"/>
							</h:outputText>
						</p:column>
						<p:column headerText="#{msgs.responsable}" sortBy="#{hierarchy.user.lastName} #{hierarchy.user.name}" styleClass="center">
							<h:outputText value="#{hierarchy.user.lastName} #{hierarchy.user.name}"/>
						</p:column>
						<p:column headerText="#{msgs.actions}" styleClass="center">
							<p:commandButton action="#{hierarchiesController.onVisualize}" ajax="true" alt="#{msgs.visualize}" image="ui-icon ui-icon-search" process="@this" title="#{msgs.visualize}" update="hierarchyTreeForm intentionForm sectionForm buttonForm">
								<f:setPropertyActionListener target="#{hierarchyVisualisationController.currentHierarchy}" value="#{hierarchy}" />
							</p:commandButton>
						</p:column>
					</p:dataTable>
					<p:outputPanel layout="block" styleClass="buttonContainer center">
						<p:commandButton actionListener="#{hierarchiesController.initHierarchyToCreate}" image="ui-icon ui-icon-circle-plus" oncomplete="dialogHierarchyCreationVar.show()" process="@this" rendered="#{sessionController.sessionUser.administrator}" type="submit" update="hierarchyCreationForm" value="#{msgs.create}"/>
						<p:commandButton image="ui-icon ui-icon-circle-close" process="@this" rendered="#{sessionController.sessionUser.administrator}" value="#{msgs.delete}"/>
					</p:outputPanel>
				</h:form>
			</p:outputPanel>
		</p:fieldset>
		<ui:include src="dialog/dialogHierarchyCreation.xhtml" />
	</ui:define>
</ui:composition>